﻿@model SIG.Model.ProductPhoto

@using (Ajax.BeginForm("AddPhoto", "Product",
    new AjaxOptions()
    {
        HttpMethod = "POST",
        OnBegin = "onBegin",
        OnComplete = "onComplete",
        OnSuccess = "uploadSuccess",
        //OnFailure = "handleError",
        UpdateTargetId = "photos-container"

    }, new { @class = "form-horizontal", role = "form" }))
{

    <!-- 添加菜单 Modal -->
    <div class="modal fade" id="ModalPhotoEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">产品图片</h4>
                </div>
                <div class="modal-body">
                    <div id="photos-container" class="container-fluid">
                        @Html.Action("GetPhotos", new { productId = Model.ProductId })
                    </div>
                  
                    <hr/>
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)
                

                    @Html.HiddenFor(model => model.ProductId)

                    <div class="form-group">
                        @Html.LabelFor(model => model.ImgURL, new { @class = "col-md-2 control-label" })
                        <div class="col-md-5">
                            <div class="input-group">
                                @Html.TextBoxFor(model => model.ImgURL, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.ImgURL, ViewData).Watermark })
                                <span class="input-group-btn">
                                    <button class="btn btn-default" id="btnThumbnail" type="button">浏览…</button>
                                </span>
                            </div><!-- /input-group -->
                            <span class="help-block">图片尺寸：800x800 像素</span>
                        </div>
                        <div class="col-md-5">
                            @Html.ValidationMessageFor(model => model.ImgURL)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Importance, new { @class = "col-md-2 control-label" })
                        <div class="col-md-5">
                            @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", type = "number", placeholder = ModelMetadata.FromLambdaExpression(x => x.Importance, ViewData).Watermark })
                        </div>
                        <div class="col-md-5">
                            @Html.ValidationMessageFor(model => model.Importance)
                        </div>

                    </div>

                                    
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                </div>
            </div>
        </div>
    </div>
}

<script type="text/javascript" language=javascript>
    $.validator.unobtrusive.parse(document);
</script>